package com.chinaisafe.user.dto;

import com.chinaisafe.user.entity.SysModule;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * SysModuleDTO
 * Description：系统资源模块数据传输对象
 *
 * @author xuefu.shu
 * @date  2024-07-12 16:06:57
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@Schema(name = "SysModuleDTO", description = "系统资源模块数据传输对象")
public class SysModuleDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键id")
    private Long id;

    @Schema(description = "应用_id")
    private Long sysAppId;

    @Schema(description = "模块名")
    private String name;

    @Schema(description = "是否启用")
    private Boolean enable;


    /**
     * 将实体类转换为数据传输对象
     * @param entity 实体对象
     * @return SysModuleDTO 数据传输对象
     * @author xuefu.shu
     * @date 2024-07-12 16:06:57
     */
    public static SysModuleDTO convertFromEntity(SysModule entity) {
        SysModuleDTO dto = new SysModuleDTO();
        dto.id = entity.getId();
        // 给对应的字段赋值 可根据实际业务删减
        dto.sysAppId = entity.getSysAppId();
        dto.name = entity.getName();
        dto.enable = entity.getEnable();
        return dto;
    }
}
